clc; close all; clear;

load saved_data\welf_app0.mat;

fprintf('Optimal DI W_app0 is %g \n\n', delta_grid(ind_max_W_app0))

% Build depositors/taxpayers
W_app0_dep = integrate_W(dWdd_app0_dep,delta_grid,delta_grid_stp);
W_app0_tax = integrate_W(dWdd_app0_tax,delta_grid,delta_grid_stp);

match_suff_stat;

fprintf('           approx       app0\n')
fprintf('MB    = % 6.8f % 6.8f\n', -dq_Fdd_1*Cdif_1,                                  MB_app0(ind_1))
fprintf('MC    = % 6.8f % 6.8f\n', -q_F_1*E_MC_tax_F_1*unins_acc_1,                   MC_app0(ind_1))
fprintf('dW_dd = % 6.8f % 6.8f\n', -dq_Fdd_1*Cdif_1 - q_F_1*E_MC_tax_F_1*unins_acc_1, dWdd_app0(ind_1))

%% Figures Paper

fig_paper_0(delta_grid, dWdd_app0, dWdd_app0_dep, dWdd_app0_tax, MB_app0, MC_app0, q_F, q_FF_1, W_app0, optfig)

fig_paper_equil(delta_grid, dq_Fdd, q_F, s_star, T_star, ...
    alpha_F_star, q_T, q_T_F, E_tax_F, E_tax_T_F, E_MC_tax_F, E_MC_tax_T_F, max_MC_tax, optfig)

fig_paper_cross(delta_grid, dWdd_app0_i, dWdd_app0_tax, D0i_grid, optfig)
